<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport"
	content="width=device-width,initial-scale=1 user-scalable=0">
<title>我的订单</title>
<link rel="stylesheet" href="<%=basePath%>assets/css/reset.css">
<link rel="stylesheet" href="<%=basePath%>assets/css/page.css">
<script src="<%=basePath%>assets/js/jquery-2.1.1.min.js"></script>
<script src="<%=basePath%>assets/js/page.js"></script>
<link rel="stylesheet" href="<%=basePath%>assets/css/public.css">
<link rel="stylesheet" href="<%=basePath%>/assets/imgTools/helmet.css">
<link rel="stylesheet" href="<%=basePath%>assets/font-awesome-4.7.0/css/font-awesome.min.css">
<script src="<%=basePath%>assets/js/textNumber.js"></script>
<link href="<%=basePath%>/assets/layer/mobile/need/layer.css" rel="stylesheet" type="text/css">
<script src="<%=basePath%>/assets/layer/mobile/layer.js"></script>
<script src="<%=basePath%>assets/js/fontSize.js"></script>
<style>
	.ddxx_nav {
		padding-top: 0.8rem;
		background: #eee;
	}
	
	.ddxx_nav ul li {
		float: left;
		width: 16%;
		padding: 0 2%
	}
	
	.ddxx_nav ul li a {
		width: 100%;
		height: 30px;
		line-height: 30px;
		text-align: center;
		color: #000;
		display: block;
		border-bottom: 3px solid #eee;
	}
	
	.ddxx_nav ul li a.active {
		color: #FF3F25;
		border-bottom: 3px solid #FF3F25;
	}
	
	.content1 {
		width: 100%;
		min-height: 50px;
		display: none
	}
	
	.content1.active {
		display: block
	}
	
	.noSJ {
		width: 100%;
		height: 8rem;
	}
	
	.noSJ img {
		width: 50%;
		margin: 0 auto 10%;
		display: block
	}
	
	.noSJ h3 {
		width: 100%;
		font-size: 0.25rem;
		line-height: 0.6rem;
		font-weight: bold;
		text-align: center
	}
	
	.noSJ p {
		width: 100%;
		font-size: 0.24rem;
		line-height: 0.6rem;
		text-align: center
	}
	.order_list1 p{
		height:0.4rem;
		line-height: 0.4rem;
		
	}
	.fa-angle-right{
		margin-left: 0.1rem;
	}
	.goodsSize{
		font-size:0.18rem;
		color: #9e8686;
	}
</style>
</head>
<body>
	<input id="basePath" type="hidden" value="<%=basePath%>">
	<div class="header">
		<!-- 返回按钮 -->
		<a class="returnInfo" href="#" onclick="returnDescend()"><i class="fa fa-angle-left"></i></a> 我的订单
	</div>

	<div class='ddxx'>
		<div class='ddxx_nav clearFirx'>
			<ul>
				<li><a herf='javascript:;' class="active">全部</a></li>
				<li><a herf='javascript:;'><span style="display: none">1</span>待付款</a></li>
				<li><a herf='javascript:;'><span style="display: none">3</span>待发货</a></li>
				<li><a herf='javascript:;'><span style="display: none">4</span>待收货</a></li>
				<li><a herf='javascript:;'><span style="display: none">5</span>待评价</a></li>
			</ul>
		</div>
		<div class='cont'>
			<!-- 	全部 -->
			<div class='content1 active'>
				<ul class="order">
					<c:forEach items="${orderList}" var="orderList">
						<c:if test="${orderList.orderStatus eq '1'}">
							<li>
								<h2>
									<div class="content">
										<a style='font-size: 1.08em; display: block; width: 100%;'
											href="<%=basePath%>app/goodsList?merchantId=${orderList.merchantId}"
											class="clearFirx"> 
											${orderList.merchantName}
											<i class="fa fa-angle-right"></i>
										</a> 
										<span>等待付款</span>
									</div>
								</h2> 
								<c:forEach items="${orderList.orderGoodsList}" var="orderGoodsList">
									<div class="order_list1" style="background: #fafafa;">
										<div class="content">
											<a href="<%=basePath%>app/toGoodsInfo?goodsId=${orderGoodsList.goodsId}">
												<img src="<%=basePath%>/app/getGoodsPhotoByName?goodsImage=${orderGoodsList.goodsThums}" alt="">
												<p class='shangpinmingcheng'>${orderGoodsList.goodsName}</p>
												<c:if test="${not empty orderGoodsList.goodsSize}">
													<p class="goodsSize">规格：${orderGoodsList.goodsSize}</p>
												</c:if>
											</a>
											<c:if test="${orderGoodsList.state eq '1'}">
												<span>￥${orderGoodsList.goodsPrice} <em>x${orderGoodsList.goodsCount}</em></span>
											</c:if>
										</div>
									</div>
								</c:forEach>
								<div class="order_info">
									<div class="content">
										<c:choose>
											<c:when test="${orderList.newOrderPrice > 0}">
												<span>
													合计：<em>￥${orderList.newOrderPrice}</em>
												</span>
											</c:when>
											<c:otherwise>
												<span style="color:#ACACAC">
													商品已下架
												</span>
											</c:otherwise>
										</c:choose>
									</div>
								</div>
								<p>
									<span class="content"> 
										<a href="#" onclick="clearOrder(${orderList.orderId})">取消订单</a>
										<c:if test="${orderList.newOrderPrice > 0}">
											<a href="#" onclick="payMoneyFunction(${orderList.orderId})">付款</a>
										</c:if>
									</span>
								</p>
							</li>
						</c:if>
						<c:if test="${orderList.orderStatus eq '2'}">
							<li>
								<h2>
									<div class="content">
										<a style='font-size: 1.08em; display: block; width: 100%;' href="<%=basePath%>app/goodsList?merchantId=${orderList.merchantId}" class="clearFirx">${orderList.merchantName}
											<i class="fa fa-angle-right"></i>
										</a>
										<span>交易关闭</span>
									</div>
								</h2> 
								<c:forEach items="${orderList.orderGoodsList}" var="orderGoodsList">
									<div class="order_list1" style="background: #fafafa;">
										<div class="content">
											<a href="<%=basePath%>app/toGoodsInfo?goodsId=${orderGoodsList.goodsId}">
												<img src="<%=basePath%>/app/getGoodsPhotoByName?goodsImage=${orderGoodsList.goodsThums}" alt="">
												<p class='shangpinmingcheng'>${orderGoodsList.goodsName}</p>
												<c:if test="${not empty orderGoodsList.goodsSize}">
													<p class="goodsSize">规格：${orderGoodsList.goodsSize}</p>
												</c:if>
											</a> 
											<span>￥${orderGoodsList.goodsPrice} 
												<em>x${orderGoodsList.goodsCount}</em>
											</span>
										</div>
									</div>

								</c:forEach>
								<div class="order_info">
									<div class="content">
										<span>
											合计：<em>￥${orderList.orderPrice}</em>
										</span>
									</div>
								</div>
								<p>
									<span class="content"> <a href="#"
										onclick="delOrder(${orderList.orderId})">删除订单</a>
									</span>
								</p>
							</li>
						</c:if>
						<c:if test="${orderList.orderStatus eq '3'}">
							<li>
								<h2>
									<div class="content">
										<a style='font-size: 1.08em; display: block; width: 100%;'
											href="<%=basePath%>app/goodsList?merchantId=${orderList.merchantId}"
											class="clearFirx"> 
											${orderList.merchantName}
											<i class="fa fa-angle-right"></i>
										</a> <span>已付款</span>
									</div>
								</h2> 
								<c:forEach items="${orderList.orderGoodsList}" var="orderGoodsList">
									<div class="order_list1" style="background: #fafafa;">
										<div class="content">
											<a href="<%=basePath%>app/toGoodsInfo?goodsId=${orderGoodsList.goodsId}">
												<img src="<%=basePath%>/app/getGoodsPhotoByName?goodsImage=${orderGoodsList.goodsThums}" alt="">
												<p class='shangpinmingcheng'>${orderGoodsList.goodsName}</p>
												<c:if test="${not empty orderGoodsList.goodsSize}">
													<p class="goodsSize">规格：${orderGoodsList.goodsSize}</p>
												</c:if>
											</a>
											<span>￥${orderGoodsList.goodsPrice}
												<em>x${orderGoodsList.goodsCount}</em>
											</span>
										</div>
									</div>
								</c:forEach>
								<div class="order_info">
									<div class="content">
										<span>
											合计：<em>￥${orderList.orderPrice}</em>
										</span>
									</div>
								</div>
								<p>
									<span class="content">
										<a href="#" onclick="remind(${orderList.orderId},${orderList.orderNo})">提醒发货</a>
									</span>
								</p>
							</li>
						</c:if>
						<c:if test="${orderList.orderStatus eq '4'}">
							<li>
								<h2>
									<div class="content">
										<a style='font-size: 1.08em; display: block; width: 100%;' href="<%=basePath%>app/goodsList?merchantId=${orderList.merchantId}" class="clearFirx"> 
											${orderList.merchantName}
											<i class="fa fa-angle-right"></i>
										</a>
										<span>已付款</span>
									</div>
								</h2>
								<c:forEach items="${orderList.orderGoodsList}" var="orderGoodsList">
									<div class="order_list1" style="background: #fafafa;">
										<div class="content">
											<a href="<%=basePath%>app/toGoodsInfo?goodsId=${orderGoodsList.goodsId}">
												<img src="<%=basePath%>/app/getGoodsPhotoByName?goodsImage=${orderGoodsList.goodsThums}" alt="">
												<p class='shangpinmingcheng'>${orderGoodsList.goodsName}</p>
												<c:if test="${not empty orderGoodsList.goodsSize}">
													<p class="goodsSize">规格：${orderGoodsList.goodsSize}</p>
												</c:if>
											</a>
											<span>￥${orderGoodsList.goodsPrice}
												<em>x${orderGoodsList.goodsCount}</em>
											</span>
										</div>
									</div>

								</c:forEach>
								<div class="order_info">
									<span style="float: left;margin-left: 0.2rem;">收货码：${orderList.userGetCode}</span>
									<div class="content">
										<span>
											合计：<em>￥${orderList.orderPrice}</em>
										</span>
									</div>
								</div>
								<p>
									<span class="content" onclick="confirmGoods(${orderList.orderId},${orderList.merchantId})"> 
										<a href="#">确认收货</a>
									</span>
								</p>
							</li>
						</c:if>
						<c:if test="${orderList.orderStatus eq '5'}">
							<li>
								<h2>
									<div class="content">
										<a style='font-size: 1.08em; display: block; width: 100%;' href="<%=basePath%>app/goodsList?merchantId=${orderList.merchantId}" class="clearFirx">
											${orderList.merchantName}
											<i class="fa fa-angle-right"></i>
										</a>
										<span>交易成功</span>
									</div>
								</h2>
								<c:forEach items="${orderList.orderGoodsList}" var="orderGoodsList">
									<div class="order_list1" style="background: #fafafa;">
										<div class="content">
											<a href="<%=basePath%>app/toGoodsInfo?goodsId=${orderGoodsList.goodsId}">
												<img src="<%=basePath%>/app/getGoodsPhotoByName?goodsImage=${orderGoodsList.goodsThums}" alt="">
												<p class='shangpinmingcheng'>${orderGoodsList.goodsName}</p>
												<c:if test="${not empty orderGoodsList.goodsSize}">
													<p class="goodsSize">规格：${orderGoodsList.goodsSize}</p>
												</c:if>
											</a> 
											<span>￥${orderGoodsList.goodsPrice}
												<em>x${orderGoodsList.goodsCount}</em>
											</span>
											<c:if test="${orderList.isAppraises eq 0}">
												<span onclick="evaluation(${orderList.orderId},${orderGoodsList.goodsId})" style="border: 1px solid #FF3F25; border-radius: 3px; padding:1px 2px 0 2px; color: #FF3F25; position: absolute; top: 54px; right: 0">评价晒单</span>
											</c:if>
										</div>
									</div>

								</c:forEach>
								<div class="order_info">
									<div class="content">
										<span>
											合计：<em>￥${orderList.orderPrice}</em>
										</span>
									</div>
								</div>
								<p>
									<span class="content" onclick="delOrder(${orderList.orderId})">
										<a href="#">删除订单</a>
									</span>
								</p>
							</li>
						</c:if>
					</c:forEach>
				</ul>

			</div>
			<!-- 待付款 -->
			<div class='content1'>
				<ul class="order">
					<c:forEach items="${orderList}" var="orderList">
						<c:if test="${orderList.orderStatus eq '1'}">
							<li>
								<h2>
									<div class="content">
										<a style='font-size: 1.08em; display: block; width: 100%;' href="<%=basePath%>app/goodsList?merchantId=${orderList.merchantId}" class="clearFirx">
											${orderList.merchantName}
											<i class="fa fa-angle-right"></i>
										</a>
										<span>等待付款</span>
									</div>
								</h2> 
								<c:forEach items="${orderList.orderGoodsList}" var="orderGoodsList">
									<div class="order_list1" style="background: #fafafa;">
										<div class="content">
											<a href="<%=basePath%>app/toGoodsInfo?goodsId=${orderGoodsList.goodsId}">
												<img src="<%=basePath%>/app/getGoodsPhotoByName?goodsImage=${orderGoodsList.goodsThums}" alt="">
												<p class='shangpinmingcheng'>${orderGoodsList.goodsName}</p>
												<c:if test="${not empty orderGoodsList.goodsSize}">
													<p class="goodsSize">规格：${orderGoodsList.goodsSize}</p>
												</c:if>
											</a> 
											<c:if test="${orderGoodsList.state eq '1'}">
												<span>￥${orderGoodsList.goodsPrice} <em>x${orderGoodsList.goodsCount}</em></span>
											</c:if>
										</div>
									</div>
								</c:forEach>
								<div class="order_info">
									<div class="content">
										<c:choose>
											<c:when test="${orderList.newOrderPrice > 0}">
												<span>
													合计：<em>￥${orderList.newOrderPrice}</em>
												</span>
											</c:when>
											<c:otherwise>
												<span style="color:#ACACAC">
													商品已下架
												</span>
											</c:otherwise>
										</c:choose>
									</div>
								</div>
								<p>
									<span class="content"> 
										<a href="#" onclick="clearOrder(${orderList.orderId})">取消订单</a>
										<c:if test="${orderList.newOrderPrice > 0}">
											<a href="#" onclick="payMoneyFunction(${orderList.orderId})">付款</a>
										</c:if>
									</span>
								</p>
							</li>
						</c:if>
					</c:forEach>
				</ul>
			</div>
			<!-- 待发货 -->
			<div class='content1'>
				<ul class="order">
					<c:forEach items="${orderList}" var="orderList">
						<c:if test="${orderList.orderStatus eq '3'}">
							<li>
								<h2>
									<div class="content">
										<a style='font-size: 1.08em; display: block; width: 100%;' href="<%=basePath%>app/goodsList?merchantId=${orderList.merchantId}" class="clearFirx">
											${orderList.merchantName}
										<i class="fa fa-angle-right"></i>
										</a>
										<span>已付款</span>
									</div>
								</h2>
								<c:forEach items="${orderList.orderGoodsList}" var="orderGoodsList">
									<div class="order_list1" style="background: #fafafa;">
										<div class="content">
											<a style='font-size: 1.08em; display: block; width: 100%;' href="<%=basePath%>app/goodsList?merchantId=${orderList.merchantId}" class="clearFirx"> 
												<img src="<%=basePath%>/app/getGoodsPhotoByName?goodsImage=${orderGoodsList.goodsThums}" alt="">
											</a>
											<p class='shangpinmingcheng'>${orderGoodsList.goodsName}</p>
											<c:if test="${not empty orderGoodsList.goodsSize}">
												<p class="goodsSize">规格：${orderGoodsList.goodsSize}</p>
											</c:if>
											</a>
											<span>￥${orderGoodsList.goodsPrice}
												<em>x${orderGoodsList.goodsCount}</em>
											</span>
										</div>
									</div>

								</c:forEach>
								<div class="order_info">
									<div class="content">
										<span>
											合计：<em>￥${orderList.orderPrice}</em>
										</span>
									</div>
								</div>
								<p>
									<span class="content">
										<a href="#" onclick="remind(${orderList.orderId},${orderList.orderNo})">提醒发货</a>
									</span>
								</p>
							</li>
						</c:if>
					</c:forEach>
				</ul>
			</div>
			<!-- 待收货 -->
			<div class='content1'>
				<ul class="order">
					<c:forEach items="${orderList}" var="orderList">
						<c:if test="${orderList.orderStatus eq '4'}">
							<li>
								<h2>
									<div class="content">
										<a style='font-size: 1.08em; display: block; width: 100%;' href="<%=basePath%>app/goodsList?merchantId=${orderList.merchantId}" class="clearFirx"> 
											${orderList.merchantName}
											<i class="fa fa-angle-right"></i>
										</a>
										<span>已付款</span>
									</div>
								</h2>
								<c:forEach items="${orderList.orderGoodsList}" var="orderGoodsList">
									<div class="order_list1" style="background: #fafafa;">
										<div class="content">
											<a href="<%=basePath%>app/toGoodsInfo?goodsId=${orderGoodsList.goodsId}">
												<img src="<%=basePath%>/app/getGoodsPhotoByName?goodsImage=${orderGoodsList.goodsThums}" alt="">
												<p class='shangpinmingcheng'>${orderGoodsList.goodsName}</p>
												<c:if test="${not empty orderGoodsList.goodsSize}">
													<p class="goodsSize">规格：${orderGoodsList.goodsSize}</p>
												</c:if>
											</a>
											<span>￥${orderGoodsList.goodsPrice} 
												<em>x${orderGoodsList.goodsCount}</em>
											</span>
										</div>
									</div>

								</c:forEach>
								<div class="order_info">
									<span style="float: left;margin-left: 0.2rem;">收货码：${orderList.userGetCode}</span>
									<div class="content">
										<span>
											合计：<em>￥${orderList.orderPrice}</em>
										</span>
									</div>
								</div>
								<p>
									<span class="content" onclick="confirmGoods(${orderList.orderId},${orderList.merchantId})">
										<a href="#">确认收货</a>
									</span>
								</p>
							</li>
						</c:if>
					</c:forEach>
				</ul>
			</div>
			<!-- 待评价 -->
			<div class='content1'>
				<ul class="order">
					<c:forEach items="${orderList}" var="orderList">
						<c:if test="${orderList.orderStatus eq '5' && orderList.isAppraises eq '0'}">
							<li>
								<h2>
									<div class="content">
										<a style='font-size: 1.08em; display: block; width: 100%;' href="<%=basePath%>app/goodsList?merchantId=${orderList.merchantId}" class="clearFirx">
											${orderList.merchantName}
											<i class="fa fa-angle-right"></i>
										</a>
										<span>交易成功</span>
									</div>
								</h2> 
								<c:forEach items="${orderList.orderGoodsList}" var="orderGoodsList">
									<div class="order_list1" style="background: #fafafa;">
										<div class="content">
											<a style='font-size: 1.08em; display: block; width: 100%;' href="<%=basePath%>app/goodsList?merchantId=${orderList.merchantId}"
												class="clearFirx">
												<img src="<%=basePath%>/app/getGoodsPhotoByName?goodsImage=${orderGoodsList.goodsThums}" alt="">
												<p class='shangpinmingcheng'>${orderGoodsList.goodsName}</p>
												<c:if test="${not empty orderGoodsList.goodsSize}">
													<p class="goodsSize">规格：${orderGoodsList.goodsSize}</p>
												</c:if>
											</a>
											<span>￥${orderGoodsList.goodsPrice}
												<em>x${orderGoodsList.goodsCount}</em>
											</span>
											<c:if test="${orderList.isAppraises eq 0}">
												<span onclick="evaluation(${orderList.orderId},${orderGoodsList.goodsId})"
													style="margin: 53px 0 0 0px; border: 1px solid #FF3F25; border-radius: 3px; padding: 1px 2px 0 2px; color: #FF3F25;">评价晒单</span>
											</c:if>
										</div>
									</div>

								</c:forEach>
								<div class="order_info">
									<div class="content">
										<span>
											合计：<em>￥${orderList.orderPrice}</em>
										</span>
									</div>
								</div>
								<p>
									<span class="content" onclick="delOrder(${orderList.orderId})"> 
										<a href="#">删除订单</a>
									</span>
								</p>
							</li>
						</c:if>
					</c:forEach>
				</ul>
			</div>
		</div>
	</div>

	<div class="noSJ" style="display: none">
		<img src="<%=basePath%>assets/images/bcz.png" alt="">
		<h3>目前没有该订单！</h3>
	</div>
</body>
<script>

	$(function(){
		$('.order').find('li').each(function(){
			var textHtml = $(this).find('.shangpinmingcheng').text();
			
			$(this).find('.shangpinmingcheng').text(showText(textHtml, 23))
	
		})
		//判断是否支付成功给个提示
		var ifSuccess = '${ifSuccess}';
		var orderNo = '${orderNo}';
	   	if(orderNo!=null&&orderNo!=""){
	   		$.ajax({
		    	url: $("#basePath").val()+"app/queryWXPayState",
		        timeout: 300000,
		        dataType: "json",
		        type: "get",
		        data: {
		        	"orderNo":orderNo
		        },success : function(data) {
		        	if(data.mapWXResult.trade_state=='SUCCESS'){
		        		var goodsName = data.orderInfoMap.goodsName.substring(0, 12);
		        		var userAddress = data.orderInfoMap.userAddress;
		        		var userPhone = data.orderInfoMap.userPhone;
		        		var userName = data.orderInfoMap.userName;
		        		var orderPrice = data.orderInfoMap.orderPrice;
		        		var orderInfo = "<h4>您成功下了一个订单</h4> <p>商品  ："+goodsName+"...</p> <p>价格："+orderPrice+"元</p> <p>收货人姓名："+userName+"</p> <p>收货电话："+userPhone+"</p> <p>收货地址："+userAddress+"</p>";
		        		layer.open({
        			  		title:['微信支付成功~', 'color: #00EE00;'],
	        			  	content: orderInfo,
	        			  	btn: '我知道了',
	        			  	shadeClose: false,
	        			  	yes: function(){
	        				  	window.location.href=$("#basePath").val()+"app/getUserOrderList";
	        			  	}
	        			});
		        	}else if(data.mapWXResult.trade_state=='NOTPAY'){
		        		layer.open({
			    		    content: '微信订单未支付~'
			    		    ,skin: 'msg'
			    		    ,time: 3
			    		  });
		        	}else if(data.mapWXResult.trade_state=='CLOSED'){
		        		layer.open({
			    		    content: '微信订单已关闭,请重新付款~'
			    		    ,skin: 'msg'
			    		    ,time: 3
			    		  });
		        	}else if(data.mapWXResult.trade_state=='REVOKED'){
		        		layer.open({
			    		    content: '微信订单刷卡已撤销,请重新付款~'
			    		    ,skin: 'msg'
			    		    ,time: 3
			    		  });
		        	}else if(data.mapWXResult.trade_state=='PAYERROR'){
		        		layer.open({
						    content: '微信付款失败,温馨提示！付款中请勿返回,以防付款失败~'
						    ,skin: 'msg'
						    ,time: 3
						  });
		        	}
		        },error : function() {
		        		layer.open({
		    		    content: '服务器出现了点状况,请稍后再尝试~'
		    		    ,skin: 'msg'
		    		    ,time: 3
		    		  });
		        }
		    });
		}else if(ifSuccess==3){
			
		}
		$('.ddxx_nav').find('li').each(function(){
			$(this).click(function(){
				$(this).siblings().find('a').removeClass('active')
				$(this).find('a').addClass('active');
				var index = $(this).index();
				$('.cont').find('.content1').removeClass('active')
				if($('.cont').find('.content1').eq(index).children().children().text()==""){
					$(".noSJ").css("display","block");
				}else{
					$(".noSJ").css("display","none");
				}
				$('.cont').find('.content1').eq(index).addClass('active');
			})
		})
		
	})

	//取消订单
	function clearOrder(orderId){
		$.ajax({
	    	url: $("#basePath").val()+"app/userCancelOrder",
	        timeout: 300000,
	        dataType: "json",
	        type: "post",
	        data: {
	        	"orderId":orderId
	        },success : function(data) {
	        	layer.open({
	    		    content: '您取消了一个订单~'
	    		    ,skin: 'msg'
	    		    ,time: 2 //2秒后自动关闭
	    		  });
	        	window.location.href=$("#basePath").val()+"app/getUserOrderList";
	        }
	    })
	}
	//删除订单
	function delOrder(orderId){
		$.ajax({
	    	url: $("#basePath").val()+"app/userDelOrder",
	        timeout: 300000,
	        dataType: "json",
	        type: "post",
	        data: {
	        	"orderId":orderId
	        },success : function(data) {
	        	layer.open({
	    		    content: '您删除一个订单~'
	    		    ,skin: 'msg'
	    		    ,time: 2 //2秒后自动关闭
	    		  });
	        	window.location.href=$("#basePath").val()+"app/getUserOrderList";
	        }
	    })
	}
	//提醒发货
	function remind(orderId,orderNo){
		$.ajax({
	    	url: $("#basePath").val()+"app/getToDayOfOrderPrompt",
	        timeout: 300000,
	        dataType: "json",
	        type: "post",
	        data: {
	        	"orderId":orderId,
	        	"orderNo":orderNo
	        },success : function(data) {
	        	if(data.num==0){
	        		layer.open({
		    		    content: '今天已经提示过了亲,请勿重复提醒发货~'
		    		    ,skin: 'msg'
		    		    ,time: 3 //2秒后自动关闭
		    		  });
	        	}else{
	        		layer.open({
		    		    content: '提醒发货成功,您的订单将会马上发货请您耐心等待~'
		    		    ,skin: 'msg'
		    		    ,time: 3 //2秒后自动关闭
		    		  });
	        	}
	        },error : function() {
	        		layer.open({
	    		    content: '服务器出现了点状况,请稍后再尝试~'
	    		    ,skin: 'msg'
	    		    ,time: 2 //2秒后自动关闭
	    		  });
	        }
	      });
	};

	$(document).ready(function(){
// 		var merchantName = "${orderList[0].merchantName}";
		var obj = "${orderList}";
		if(obj == "[]"){
			$(".noSJ").css("display","block");
		}
	});
	//评价晒单
	function evaluation(orderId,goodsId){
		window.location.href=$("#basePath").val()+"app/toAddGoodsAppraises?orderId="+orderId+"&goodsId="+goodsId;
	};
	
	//付款
	function payMoneyFunction(orderId){
	  //loading带文字
	  layer.open({
	    type: 2,
	    Number:2,
	    shadeClose:false,
	    content: '微信支付中...'
	  });
		$.ajax({
	    	url: $("#basePath").val()+"app/createWxH5Pay",
	        timeout: 300000,
	        dataType: "json",
	        type: "get",
	        data: {
	        	"orderId":orderId
	        },success : function(data) {
	        	window.location.href=data.rtnUrl;
	        	layer.closeAll();
	        },error : function() {
	        		layer.open({
	    		    content: '服务器出现了点状况,请稍后再尝试~'
	    		    ,skin: 'msg'
	    		    ,time: 2 //2秒后自动关闭
	    		  });
	        }
	    })
	};
	//确认收货
	function confirmGoods(orderId,merchantId){
		  //询问框
		  layer.open({
		    content: '您确定已经收到此商品吗？'
		    ,btn: ['确定', '取消']
		    ,yes: function(index){
		      
		      $.ajax({
			    	url: $("#basePath").val()+"app/userConfirmReceipt",
			        timeout: 300000,
			        dataType: "json",
			        type: "get",
			        data: {
			        	"orderId":orderId,
			        	"merchantId":merchantId
			        },success : function(data) {
			        	if(data.state==1){
			        		layer.open({
				    		    content: '收货成功~'
				    		    ,skin: 'msg'
				    		    ,time: 2 //2秒后自动关闭
				    		  });
			        		location.reload();
			        	}else{
			        		layer.open({
				    		    content: '收货失败~'
				    		    ,skin: 'msg'
				    		    ,time: 2 //2秒后自动关闭
				    		  });
			        	}
			        },error : function() {
			        		layer.open({
			    		    content: '服务器出现了点状况,请稍后再尝试~'
			    		    ,skin: 'msg'
			    		    ,time: 2 //2秒后自动关闭
			    		  });
			        }
			    })
		      layer.close(index);
		    }
		  });
	};
	
	//返回上一层
	function returnDescend(){
		window.location.href=$("#basePath").val()+"app/toPersonCenter";
	};
</script>
</html>